package com.mew.common.rest.bo;

import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;

public class MaxBonusManager {

    private static MaxBonusManager maxBonusManager = new MaxBonusManager();
    private final CopyOnWriteArrayList<MaxBonusBO> bonusCache = new CopyOnWriteArrayList();
    private MaxBonusManager(){}

    public static MaxBonusManager getInstance() {
        if (maxBonusManager == null) {
            synchronized (MaxBonusManager.class) {
                if (maxBonusManager == null) {
                    maxBonusManager = new MaxBonusManager();
                }
            }
        }
        return maxBonusManager;
    }


    public void add(MaxBonusBO bonusBO){
        if (bonusCache.size() > 12){
            return;
        }
        bonusCache.add(bonusBO);
    }

    public void clear(){
        bonusCache.clear();
    }

    public List<MaxBonusBO> getBonusCache() {
        return bonusCache;
    }
}
